package com.aids_malaria.http.response;

import android.arch.persistence.room.Embedded;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;

import com.aids_malaria.util.GsonUtil;
import com.litesuits.orm.db.annotation.NotNull;
import com.litesuits.orm.db.enums.AssignType;

import java.io.Serializable;

@Entity(tableName = "eaProcessPack",primaryKeys = {"identity_code","record_no","record_seq"})
public class EaProcessPack implements Serializable {

//    @PrimaryKey(AssignType.BY_MYSELF)
    @NonNull
    private String identity_code;
    private int record_no; // 诊断记录号
    private int record_seq; //记录次数
    private String indoor_spray_agent; //室内喷洒药剂
    @Embedded
    public OutdoorSprayAgent outdoor_spray_agent; // 室外喷洒药剂
    private String outdoor_spray_agent_json; // 室外喷洒药剂
    private int out_range; // 室外喷洒范围
    private int bednets_mu_rate; // 每月使用蚊帐率
    private String investor;
    private String create_time;
    private String update_time;
    private String spray_time;

    private boolean createOrUpdate;

    public boolean isCreateOrUpdate() {
        return createOrUpdate;
    }

    public void setCreateOrUpdate(boolean createOrUpdate) {
        this.createOrUpdate = createOrUpdate;
    }

    public static EaProcessPack copyFromNoPack(EaProcess eaProcess){
        EaProcessPack eaProcessPack = new EaProcessPack();
        eaProcessPack.setIdentity_code(eaProcess.getIdentity_code());
        eaProcessPack.setRecord_no(eaProcess.getRecord_no());
        eaProcessPack.setRecord_seq(eaProcess.getRecord_seq());
        eaProcessPack.setIndoor_spray_agent(eaProcess.getIndoor_spray_agent());
        eaProcessPack.setOut_range(eaProcess.getOut_range());
        eaProcessPack.setBednets_mu_rate(eaProcess.getBednets_mu_rate());
        eaProcessPack.setInvestor(eaProcess.getInvestor());
        eaProcessPack.setCreate_time(eaProcess.getCreate_time());
        eaProcessPack.setUpdate_time(eaProcess.getUpdate_time());
        eaProcessPack.setSpray_time(eaProcess.getSpray_time());
        String outdoor_spray_agent = eaProcess.getOutdoor_spray_agent();
        eaProcessPack.setOutdoor_spray_agent_json(outdoor_spray_agent);
        OutdoorSprayAgent outdoorSprayAgent = GsonUtil.gsonToBean(outdoor_spray_agent, OutdoorSprayAgent.class);
        eaProcessPack.setOutdoor_spray_agent(outdoorSprayAgent);
        return eaProcessPack;
    }

    private int busy_type;

    public int getBusy_type() {
        return busy_type;
    }

    public void setBusy_type(int busy_type) {
        this.busy_type = busy_type;
    }

    public String getOutdoor_spray_agent_json() {
        return outdoor_spray_agent_json;
    }

    public void setOutdoor_spray_agent_json(String outdoor_spray_agent_json) {
        this.outdoor_spray_agent_json = outdoor_spray_agent_json;
    }

    public String getIdentity_code() {
        return identity_code;
    }

    public void setIdentity_code(String identity_code) {
        this.identity_code = identity_code;
    }

    public int getRecord_no() {
        return record_no;
    }

    public void setRecord_no(int record_no) {
        this.record_no = record_no;
    }

    public int getRecord_seq() {
        return record_seq;
    }

    public void setRecord_seq(int record_seq) {
        this.record_seq = record_seq;
    }

    public String getIndoor_spray_agent() {
        return indoor_spray_agent;
    }

    public void setIndoor_spray_agent(String indoor_spray_agent) {
        this.indoor_spray_agent = indoor_spray_agent;
    }

    public OutdoorSprayAgent getOutdoor_spray_agent() {
        return outdoor_spray_agent;
    }

    public void setOutdoor_spray_agent(OutdoorSprayAgent outdoor_spray_agent) {
        this.outdoor_spray_agent = outdoor_spray_agent;
    }

    public int getOut_range() {
        return out_range;
    }

    public void setOut_range(int out_range) {
        this.out_range = out_range;
    }

    public int getBednets_mu_rate() {
        return bednets_mu_rate;
    }

    public void setBednets_mu_rate(int bednets_mu_rate) {
        this.bednets_mu_rate = bednets_mu_rate;
    }

    public String getInvestor() {
        return investor;
    }

    public void setInvestor(String investor) {
        this.investor = investor;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public String getSpray_time() {
        return spray_time;
    }

    public void setSpray_time(String spray_time) {
        this.spray_time = spray_time;
    }

    @Override
    public String toString() {
        return "EaProcessPack{" +
                "identity_code='" + identity_code + '\'' +
                ", record_no=" + record_no +
                ", record_seq=" + record_seq +
                ", indoor_spray_agent='" + indoor_spray_agent + '\'' +
                ", outdoor_spray_agent=" + outdoor_spray_agent +
                ", out_range=" + out_range +
                ", bednets_mu_rate=" + bednets_mu_rate +
                ", investor='" + investor + '\'' +
                ", create_time='" + create_time + '\'' +
                ", update_time='" + update_time + '\'' +
                ", spray_time='" + spray_time + '\'' +
                '}';
    }

    public static class OutdoorSprayAgent{
        private String other;

        private int pirimiphos_methyl;

        public String getOther() {
            return other;
        }

        public void setOther(String other) {
            this.other = other;
        }

        public int getPirimiphos_methyl() {
            return pirimiphos_methyl;
        }

        public void setPirimiphos_methyl(int pirimiphos_methyl) {
            this.pirimiphos_methyl = pirimiphos_methyl;
        }

        @Override
        public String toString() {
            return "OutdoorSprayAgent{" +
                    "other='" + other + '\'' +
                    ", pirimiphos_methyl=" + pirimiphos_methyl +
                    '}';
        }
    }
}
